import { Community } from "./Community"
import { CommunityUart } from './community_impl/CommunityUart';

/**
 * 称重传感器单例的模式
 * @author an-ran0
 * 不建议直接使用，可能会在后续的版本中变更，使用错误可能会导致WeightUtil失效
 */
export class CommunitSingleton {
  private static communit: Community = null;

  public  static getInstance = () => {
    if (CommunitSingleton.communit == null) {
      CommunitSingleton.communit = new CommunityUart()
      CommunitSingleton.communit.init();
    }
    console.log(`an-ran0 CommunitSingleton`);
    return CommunitSingleton.communit;
  }
}
